/**
 *  基本模块
 */


const G = require('./glb');

const path = require('path');

const Koa = require('koa');

const app = new Koa();
//方便访问
G.app = app;
global.G = G;

const cors = require('koa2-cors');
const koaBody = require('koa-body');

//-------------- my middlewares
const router = require('./router');

// cors
// bodyParser
app.use(cors());
app.use(koaBody());

// route
app.use(router(app));

G.dbUtils.init(path.join(__dirname,"mytestdb.db"));
// G.dayStamp = G.getDayStamp();
// G.reqId = 0;

app.listen(3000,()=>{
   console.log('server start http://localhost:3000');
});

//
